<!--
    新闻的前端显示页面

    author Yuanao
    date 2021年11月11日22:17:27
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>在线预约</title>

    <!-- css -->
    <link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="/plugins/cubeportfolio/css/cubeportfolio.min.css">
    <link href="/css/nivo-lightbox.css" rel="stylesheet"/>
    <link href="/css/nivo-lightbox-theme/default/default.css" rel="stylesheet" type="text/css"/>
    <link href="/css/owl.carousel.css" rel="stylesheet" media="screen"/>
    <link href="/css/owl.theme.css" rel="stylesheet" media="screen"/>
    <link href="/css/animate.css" rel="stylesheet"/>
    <link href="/css/style.css" rel="stylesheet">

    <!-- boxed bg -->
    <link id="bodybg" href="/bodybg/bg1.css" rel="stylesheet" type="text/css"/>
    <!-- template skin -->
    <link id="t-colors" href="/color/default.css" rel="stylesheet">
    <!--    -->
    <script src="/js/pageWriteHtml.js" charset="UTF-8"></script>
    <style>
        #title {
            text-align: center;
        }
        #content {
            width: 80%;
            margin: 10px auto;
        }
        #newsFooter{
            width: 80%;
            margin: 10px auto;
            text-align: right;
        }
    </style>
</head>

<body id="page-top" data-spy="scroll" data-target=".navbar-custom">

<div id="wrapper">

    <!--  将头部信息写入到这里  -->
    <script>writeHtmlAsHead();</script>


    <div id="show_row" style="margin-top: 200px">
        <h1 id="title"></h1>
        <div id="content"></div>
        <div id="newsFooter"></div>
    </div>




    <!--  将头部信息写入到这里  -->
    <script>writeHtmlAsFooter();</script>


</div>
<a href="#" class="scrollup"><i class="fa fa-angle-up active"></i></a>

<!-- Core JavaScript Files -->
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/jquery.easing.min.js"></script>
<script src="/js/wow.min.js"></script>
<script src="/js/jquery.scrollTo.js"></script>
<script src="/js/jquery.appear.js"></script>
<script src="/js/stellar.js"></script>
<script src="/plugins/cubeportfolio/js/jquery.cubeportfolio.min.js"></script>
<script src="/js/owl.carousel.min.js"></script>
<script src="/js/nivo-lightbox.min.js"></script>
<script src="/js/custom.js"></script>
<script src="/contactform/contactform.js"></script>

<script>

    //说明:获取url参数
    //参数obj:访问路径
    //返回值:参数
    var id = getQueryString("id");

    function getQueryString(name) {
        let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        let r = window.location.search.substr(1).match(reg);
        if (r !== null)
            return unescape(r[2]);
        return null;
    }

    if (id == null || id == undefined || id == "") {
        alert("id获取失败,请尝试刷新")
    }

    //获取指定新闻的信息
    $.post("http://localhost:8080/api/news/getNewsById",{
        id:id
    },(data)=> {
        if (data.code === 0) {
            let obj = data.data;
            $("#title").html(obj.title);
            $("#content").html(decodeURIComponent(obj.content));
            $("#newsFooter").html(obj.adminUserName +" "+ obj.time);

        }
    })
</script>
</body>

</html>
